package o;

import android.text.TextUtils;
import androidx.viewpager.widget.ViewPager;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.BaseListFragment;
import com.huawei.hwid.core.constants.HwAccountConstants;
import huawei.widget.HwSubTabWidget.a;
import huawei.widget.HwSubTabWidget.b;
import java.lang.ref.WeakReference;
import java.util.List;
import o.chr.e;

public class chs implements b {
    private WeakReference<BaseListFragment> ˊ;

    public chs(BaseListFragment baseListFragment) {
        if (baseListFragment != null) {
            this.ˊ = new WeakReference(baseListFragment);
        }
    }

    public void ˊ(a aVar, FragmentTransaction kaVar) {
        if (this.ˊ != null) {
            BaseListFragment baseListFragment = (BaseListFragment) this.ˊ.get();
            if (baseListFragment != null) {
                baseListFragment.ʾॱ();
            }
        }
    }

    public void ˎ(a aVar, FragmentTransaction kaVar) {
        if (aVar == null || this.ˊ == null) {
            Logger.e("SubTabSelected", "onSubTabSelected, tab = " + aVar + ", baseListFragmentRef = " + this.ˊ);
            return;
        }
        BaseListFragment baseListFragment = (BaseListFragment) this.ˊ.get();
        if (baseListFragment != null) {
            ˋ(aVar, baseListFragment);
            ViewPager viewPager = baseListFragment.ॱˑ;
            if (viewPager != null && viewPager.getCurrentItem() != aVar.ˏ()) {
                viewPager.setCurrentItem(aVar.ˏ());
                return;
            }
            return;
        }
        Logger.e("SubTabSelected", "onSubTabSelected, baseListFragment == null");
    }

    public void ॱ(a aVar, FragmentTransaction kaVar) {
    }

    private void ˋ(a aVar, BaseListFragment baseListFragment) {
        List list = baseListFragment.ᐝʽ;
        if (CollectCheck.isEmpty(list)) {
            Logger.e("SubTabSelected", "reportTabClick, tabItemList is empty.");
            return;
        }
        dgp o_dgp = (dgp) list.get(aVar.ˏ());
        if (o_dgp == null || TextUtils.isEmpty(o_dgp.ˏ())) {
            Logger.e("SubTabSelected", "reportTabClick, tabItem = " + (o_dgp == null ? HwAccountConstants.NULL : o_dgp.ˏ()));
            return;
        }
        baseListFragment.ͺ(o_dgp.ˏ());
        chp.ˋ(new e().ˊ(o_dgp.ˏ()).ˎ(o_dgp.ˊ()).ˏ(String.valueOf(dgm.ˎ(baseListFragment.ॱˋ()))).ˎ());
        Logger.ˎ("SubTabSelected", "reportTabClick, subtab_click, tabId = " + o_dgp.ˏ());
    }
}
